#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(string a, string b)
{
    return a + b < b + a;
}
int main()
{
    int n, i, len = 0;
    vector<string> parts;
    string str, res = "";
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> str;
        parts.push_back(str);
    }
    sort(parts.begin(), parts.end(), cmp);
    for (i = 0; i < n; i++)
        res += parts[i];
    while (res.length() != 0 && res[0] == '0')
        res.erase(res.begin());
    if (res.length() == 0)
        cout << 0;
    cout << res;
    return 0;
}